home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Development Tools & Languages / Dylan Related / Mindy-1.1 (sources only) / mindy-1.1 / interp / coll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-28  |  3.3 KB  |  97 lines  |  [TEXT/ttxt]

  1. /**********************************************************************\
  2. *
  3. *  Copyright (c) 1994  Carnegie Mellon University
  4. *  All rights reserved.
  5. *  
  6. *  Use and copying of this software and preparation of derivative
  7. *  works based on this software are permitted, including commercial
  8. *  use, provided that the following conditions are observed:
  9. *  
  10. *  1. This copyright notice must be retained in full on any copies
  11. *     and on appropriate parts of any derivative works.
  12. *  2. Documentation (paper or online) accompanying any system that
  13. *     incorporates this software, or any part of it, must acknowledge
  14. *     the contribution of the Gwydion Project at Carnegie Mellon
  15. *     University.
  16. *  
  17. *  This software is made available "as is".  Neither the authors nor
  18. *  Carnegie Mellon University make any warranty about the software,
  19. *  its performance, or its conformity to any specification.
  20. *  
  21. *  Bug reports, questions, comments, and suggestions should be sent by
  22. *  E-mail to the Internet address "gwydion-bugs@cs.cmu.edu".
  23. *
  24. ***********************************************************************
  25. *
  26. * $Header: coll.c,v 1.5 94/06/27 16:31:32 wlott Exp $
  27. *
  28. * This file implements the collection framework.
  29. *
  30. \**********************************************************************/
  31.  
  32. #include "mindy.h"
  33. #include "class.h"
  34. #include "obj.h"
  35. #include "gc.h"
  36. #include "coll.h"
  37.  
  38. obj_t obj_CollClass = 0;
  39. obj_t obj_ExKeyCollClass = 0;
  40. obj_t obj_MutCollClass = 0;
  41. obj_t obj_SeqClass = 0;
  42. obj_t obj_MutExKeyCollClass = 0;
  43. obj_t obj_MutSeqClass = 0;
  44. obj_t obj_ArrayClass = 0;
  45. obj_t obj_VectorClass = 0;
  46. obj_t obj_StringClass = 0;
  47.  
  48.  
  49. /* GC stuff. */
  50.  
  51. void scavenge_coll_roots(void)
  52. {
  53.     scavenge(&obj_CollClass);
  54.     scavenge(&obj_ExKeyCollClass);
  55.     scavenge(&obj_MutCollClass);
  56.     scavenge(&obj_SeqClass);
  57.     scavenge(&obj_MutExKeyCollClass);
  58.     scavenge(&obj_MutSeqClass);
  59.     scavenge(&obj_ArrayClass);
  60.     scavenge(&obj_VectorClass);
  61.     scavenge(&obj_StringClass);
  62. }
  63.  
  64.  
  65. /* Init stuff. */
  66.  
  67. void make_coll_classes(void)
  68. {
  69.     obj_CollClass = make_abstract_class(FALSE);
  70.     obj_ExKeyCollClass = make_abstract_class(FALSE);
  71.     obj_MutCollClass = make_abstract_class(FALSE);
  72.     obj_SeqClass = make_abstract_class(FALSE);
  73.     obj_MutExKeyCollClass = make_abstract_class(FALSE);
  74.     obj_MutSeqClass = make_abstract_class(FALSE);
  75.     obj_ArrayClass = make_abstract_class(FALSE);
  76.     obj_VectorClass = make_abstract_class(FALSE);
  77.     obj_StringClass = make_abstract_class(FALSE);
  78. }
  79.  
  80. void init_coll_classes(void)
  81. {
  82.     init_builtin_class(obj_CollClass, "<collection>", obj_ObjectClass, NULL);
  83.     init_builtin_class(obj_ExKeyCollClass, "<explicit-key-collection>",
  84.                obj_CollClass, NULL);
  85.     init_builtin_class(obj_MutCollClass, "<mutable-collection>",
  86.                obj_CollClass, NULL);
  87.     init_builtin_class(obj_SeqClass, "<sequence>", obj_CollClass, NULL);
  88.     init_builtin_class(obj_MutExKeyCollClass,
  89.                "<mutable-explicit-key-collection>",
  90.                obj_MutCollClass, obj_ExKeyCollClass, NULL);
  91.     init_builtin_class(obj_MutSeqClass, "<mutable-sequence>",
  92.                obj_MutCollClass, obj_SeqClass, NULL);
  93.     init_builtin_class(obj_ArrayClass, "<array>", obj_MutSeqClass, NULL);
  94.     init_builtin_class(obj_VectorClass, "<vector>", obj_ArrayClass, NULL);
  95.     init_builtin_class(obj_StringClass, "<string>", obj_MutSeqClass, NULL);
  96. }
  97.